#include "deprecated/gtkrc.h"
#define SIMPLE_ID "gtk-im-context-simple"
+#define NONE_ID "gtk-im-context-none"
/**
* GtkIMContextInfo:
* The structures it points are statically allocated and should
* not be modified or freed.
* @n_contexts: the length of the array stored in @contexts
- *
+ *
* List all available types of input method context
*/
void
#endif
GtkIMContextInfo simple_context_info = {
SIMPLE_ID,
- N_("Simple"),
+ NC_("input method menu", "Simple"),
+ GETTEXT_PACKAGE,
+#ifdef GTK_LOCALEDIR
+ GTK_LOCALEDIR,
+#else
+ "",
+#endif
+ ""
+ };
+
+ static
+#ifndef G_OS_WIN32
+ const
+#endif
+ GtkIMContextInfo none_context_info = {
+ NONE_ID,
+ NC_("input method menu", "None"),
GETTEXT_PACKAGE,
#ifdef GTK_LOCALEDIR
GTK_LOCALEDIR,
*/
simple_context_info.domain_dirname = g_strdup (simple_context_info.domain_dirname);
correct_localedir_prefix ((char **) &simple_context_info.domain_dirname);
+ none_context_info.domain_dirname = g_strdup (none_context_info.domain_dirname);
+ correct_localedir_prefix ((char **) &none_context_info.domain_dirname);
}
#endif
if (n_contexts)
- *n_contexts = (n_loaded_contexts + 1);
+ *n_contexts = n_loaded_contexts + 2;
if (contexts)
{
GSList *tmp_list;
int i;
-
- *contexts = g_new (const GtkIMContextInfo *, n_loaded_contexts + 1);
+ *contexts = g_new (const GtkIMContextInfo *, n_loaded_contexts + 2);
+
+ (*contexts)[n++] = &none_context_info;
(*contexts)[n++] = &simple_context_info;
tmp_list = modules_list;
for (i=0; i<module->n_contexts; i++)
(*contexts)[n++] = module->contexts[i];
-
+
tmp_list = tmp_list->next;
}
- /* fisrt element (Default) should always be at top */
- qsort ((*contexts)+1, n-1, sizeof (GtkIMContextInfo *), (GCompareFunc)compare_gtkimcontextinfo_name);
+ /* first elements (Simple and None) should always be at top */
+ qsort ((*contexts)+2, n-2, sizeof (GtkIMContextInfo *), (GCompareFunc)compare_gtkimcontextinfo_name);
}
}
{
GtkIMModule *im_module;
GtkIMContext *context = NULL;
-
+
+ if (strcmp (context_id, NONE_ID) == 0)
+ return NULL;
+
if (!contexts_hash)
gtk_im_module_initialize ();
context = im_module->create (context_id);
g_type_module_unuse (G_TYPE_MODULE (im_module));
}
-
+
if (!context)
g_warning ("Loading IM context type '%s' failed", context_id);
}
}
-
+
if (!context)
return gtk_im_context_simple_new ();
else
{
if (g_strcmp0 (*immodules_list, SIMPLE_ID) == 0)
return SIMPLE_ID;
+ else if (g_strcmp0 (*immodules_list, NONE_ID) == 0)
+ return NONE_ID;
else
{
gboolean found;
*/
-#define NONE_ID "gtk-im-context-none"
-
struct _GtkIMMulticontextPrivate
{
GtkIMContext *slave;
priv->context_id = g_strdup (get_effective_context_id (multicontext));
- if (g_strcmp0 (priv->context_id, NONE_ID) == 0)
- return NULL;
-
slave = _gtk_im_module_create (priv->context_id);
- gtk_im_multicontext_set_slave (multicontext, slave, FALSE);
- g_object_unref (slave);
+ if (slave)
+ {
+ gtk_im_multicontext_set_slave (multicontext, slave, FALSE);
+ g_object_unref (slave);
+ }
}
return priv->slave;
gtk_widget_show (menuitem);
gtk_menu_shell_append (menushell, menuitem);
- menuitem = gtk_radio_menu_item_new_with_label (group, C_("input method menu", "None"));
- if (g_strcmp0 (priv->context_id_aux, NONE_ID) == 0)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
- g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"), NONE_ID);
- g_signal_connect (menuitem, "activate", G_CALLBACK (activate_cb), context);
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (menushell, menuitem);
- group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
-
- menuitem = gtk_separator_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (menushell, menuitem);
-
_gtk_im_module_list (&contexts, &n_contexts);
for (i = 0; i < n_contexts; i++)
* GTK+. Input method may have a name in the GTK+
* message catalog.
*/
- translated_name = _(contexts[i]->context_name);
+ translated_name = C_("input method menu", contexts[i]->context_name);
}
else
{
#else
translated_name = contexts[i]->context_name;
#endif
- menuitem = gtk_radio_menu_item_new_with_label (group,
- translated_name);
-
+ menuitem = gtk_radio_menu_item_new_with_label (group, translated_name);
+
if ((priv->context_id_aux &&
strcmp (contexts[i]->context_id, priv->context_id_aux) == 0))
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
text = g_strdup_printf (C_("input method menu", "System (%s)"), translated_name);
gtk_label_set_text (GTK_LABEL (label), text);
g_free (text);
- }
-
+ }
+
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
-
+
g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"),
(char *)contexts[i]->context_id);
g_signal_connect (menuitem, "activate",
static const GtkIMContextInfo am_et_info = {
"am_et", /* ID */
- N_("Amharic (EZ+)"), /* Human readable name */
+ NC_("input method menu", "Amharic (EZ+)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"am" /* Languages for which this module is the default */
static const GtkIMContextInfo imbroadway_info =
{
"broadway", /* ID */
- "Broadway", /* Human readable name */
+ NC_("input method menu", "Broadway"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"", /* Languages for which this module is the default */
static const GtkIMContextInfo cedilla_info = {
"cedilla", /* ID */
- N_("Cedilla"), /* Human readable name */
+ NC_("input method menu", "Cedilla"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain */
"az:ca:co:fr:gv:oc:pt:sq:tr:wa" /* Languages for which this module is the default */
static const GtkIMContextInfo cyrillic_translit_info = {
"cyrillic_translit", /* ID */
- N_("Cyrillic (Transliterated)"), /* Human readable name */
+ NC_("input menthod menu", "Cyrillic (Transliterated)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"" /* Languages for which this module is the default */
static const GtkIMContextInfo ime_info = {
"ime",
- "Windows IME",
- "gtk+",
+ NC_("input method menu", "Windows IME"),
+ GETTEXT_PACKAGE,
"",
"ja:ko:zh",
};
static const GtkIMContextInfo inuktitut_info = {
"inuktitut", /* ID */
- N_("Inuktitut (Transliterated)"), /* Human readable name */
+ NC_("input method menu", "Inuktitut (Transliterated)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"iu" /* Languages for which this module is the default */
static const GtkIMContextInfo ipa_info = {
"ipa", /* ID */
- N_("IPA"), /* Human readable name */
+ NC_("input method menu", "IPA"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"" /* Languages for which this module is the default */
*/
static const GtkIMContextInfo info = {
CONTEXT_ID, /* ID */
- N_("Multipress"), /* Human readable name */
+ NC_("input method menu", "Multipress"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain. Defined in configure.ac */
MULTIPRESS_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+"). Defined in the Makefile.am */
"" /* Languages for which this module is the default */
static const GtkIMContextInfo imquartz_info =
{
"quartz",
- "Mac OS X Quartz",
+ NC_("input method menu", "Mac OS X Quartz"),
GETTEXT_PACKAGE,
GTK_LOCALEDIR,
"ja:ko:zh:*",
static const GtkIMContextInfo thai_info = {
"thai", /* ID */
- N_("Thai-Lao"), /* Human readable name */
+ NC_("input method menu", "Thai-Lao"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"lo:th" /* Languages for which this module is the default */
static const GtkIMContextInfo ti_er_info = {
"ti_er", /* ID */
- N_("Tigrigna-Eritrean (EZ+)"), /* Human readable name */
+ NC_("input method menu", "Tigrigna-Eritrean (EZ+)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"ti" /* Languages for which this module is the default */
static const GtkIMContextInfo ti_et_info = {
"ti_et", /* ID */
- N_("Tigrigna-Ethiopian (EZ+)"), /* Human readable name */
+ NC_("input method menu", "Tigrigna-Ethiopian (EZ+)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"ti" /* Languages for which this module is the default */
static const GtkIMContextInfo viqr_info = {
"viqr", /* ID */
- N_("Vietnamese (VIQR)"), /* Human readable name */
+ NC_("input method menu", "Vietnamese (VIQR)"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"vi" /* Languages for which this module is the default */
static const GtkIMContextInfo xim_ja_info = {
"xim", /* ID */
- N_("X Input Method"), /* Human readable name */
+ NC_("input method menu", "X Input Method"), /* Human readable name */
GETTEXT_PACKAGE, /* Translation domain */
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
"ko:ja:th:zh" /* Languages for which this module is the default */